<?php

class Convert extends Core {
	public static function number($number) {
		return number_format($number, 0, null, '.');	
	}
	
	public function porcent($one, $two) {
		if ($one > $two) {
			$porcent = 100;
		} else {
			$porcent = round(($one * 100) / $two, 2);
		}
		return $porcent;
	}

	public static function avatar($avatar) {
		if ($avatar == '') {
			$r = '/mithos/images/avatars/sem-avatar.jpg';
		} elseif (!file_exists(Mapper::base() . '/core/images/avatars/' . $avatar)) {
			$r = '/mithos/images/avatars/sem-avatar.jpg';
		} else {
			$r = '/mithos/images/avatars/' . $avatar;
		}
		return $r;
	}

	public static function race($number) {
		switch ($number) {
			case 0 : $class = 'Dark Wizard'; break;
			case 1 : $class = 'Soul Master'; break;
			case 2 : $class = 'Grand Master'; break;
			case 3 : $class = 'Grand Master'; break;
			case 16 : $class = 'Dark Knight'; break;
			case 17 : $class = 'Blade Knight'; break;
			case 18 : $class = 'Blade Master'; break;
			case 19 : $class = 'Blade Master'; break;
			case 33 : $class = 'Fary Elf'; break;
			case 34 : $class = 'Muse Elf'; break;
			case 35 : $class = 'High Elf'; break;
			case 36 : $class = 'High Elf'; break;
			case 48 : $class = 'Magic Gladiator'; break;
			case 49 : $class = 'Duel Master'; break;
			case 50 : $class = 'Duel Master'; break;
			case 64 : $class = 'Dark Lord'; break;
			case 65 : $class = 'Lord Emperor'; break;
			case 66 : $class = 'Lord Emperor'; break;
			case 80 : $class = 'Summoner'; break;
			case 81 : $class = 'Blood Summoner'; break;
			case 82 : $class = 'Dimension Master'; break;
			case 83 : $class = 'Dimension Master'; break;
			case 96 : $class = 'Rage Fighter'; break;
			case 97 : $class = 'Fist Master'; break;
			case 98 : $class = 'Fist Master'; break;
			default : $class = '---';
		}
		return $class;
	}
	
	public static function map($number) {
		switch ($number) {
			case 0 : $map = 'Lorencia'; break;
			case 1 : $map = 'Dungeon'; break;
			case 2 : $map = 'Devias'; break;
			case 3 : $map = 'Noria'; break;
			case 4 : $map = 'Losttower'; break;
			case 5 : $map = 'Exile'; break;
			case 6 : $map = 'Stadium'; break;
			case 7 : $map = 'Atlans'; break;
			case 8 : $map = 'Tarkan'; break;
			case 10 : $map = 'Icarus'; break;
			case 11 : $map = 'Blood Castle 1'; break;
			case 12 : $map = 'Blood Castle 2'; break;
			case 13 : $map = 'Blood Castle 3'; break;
			case 14 : $map = 'Blood Castle 4'; break;
			case 15 : $map = 'Blood Castle 5'; break;
			case 16 : $map = 'Blood Castle 6'; break;
			case 17 : $map = 'Blood Castle 7'; break;
			case 18 : $map = 'Chaos Castle'; break;
			case 19 : $map = 'Chaos Castle'; break;
			case 20 : $map = 'Chaos Castle'; break;
			case 21 : $map = 'Chaos Castle'; break;
			case 22 : $map = 'Chaos Castle'; break;
			case 23 : $map = 'Chaos Castle'; break;
			case 24 : $map = 'Kalima 1'; break;
			case 25 : $map = 'Kalima 2'; break;
			case 26 : $map = 'Kalima 3'; break;
			case 27 : $map = 'Kalima 4'; break;
			case 28 : $map = 'Kalima 5'; break;
			case 29 : $map = 'Kalima 6'; break;
			case 36 : $map = 'Lost Kalima'; break;
			case 31 : $map = 'Lands Of Trials'; break;
			case 33 : $map = 'Aida'; break;
			case 34 : $map = 'Crywolf'; break;
			case 37 : $map = 'Kantru'; break;
			case 45 : $map = 'Illusion Temple 1'; break;
			case 46 : $map = 'Illusion Temple 2'; break;
			case 47 : $map = 'Illusion Temple 3'; break;
			case 48 : $map = 'Illusion Temple 4'; break;
			case 49 : $map = 'Illusion Temple 5'; break;
			case 50 : $map = 'Illusion Temple 6'; break;
			case 41 : $map = 'Barracks Of Balgass'; break;
			case 42 : $map = 'Silent Map'; break;
			case 51 : $map = 'Elbeland'; break;
			default : $map = '---';
		}
		return $map;
	}
}

?>